<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(App\User::class, function (Faker\Generator $faker) {
    static $password;

    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'password' => $password ?: $password = bcrypt('secret'),
        'remember_token' => str_random(10),
    ];
});

$factory->define(\App\EcmsHtfComment::class, function($faker) {
    $a_ids = \App\EcmsNew::pluck('id')->toArray(); //取出文章id
    return [
        'p_id' => mt_rand(1,2),
        'a_id' => $faker->randomElement($a_ids),
        'c_id' => '1', //分类id，现在没有什么用处
        'tel' => (string)mt_rand(100,999).'3600'.mt_rand(1000,9999), //手机号
        //'content' => join("\n\n", $faker->paragraphs(mt_rand(3, 6))),
        'content' => $faker->text($maxNbChars = 200),
        'zan' => mt_rand(1, 500),
        'create_time' => $faker->dateTimeThisYear($max = 'now')
    ];
});
